<template>
  <main>
    <div class="btn">
      <a :href="hrefUrl" class="button" id="openHeader">立即打开</a>
    </div>
  </main>
</template>

<script>
import linkedmeLink from './linkedme.js';

export default {
  name: 'linkedme-test',
  data() {
    return {
      hrefUrl: '',
    };
  },
  methods: {},
  mounted() {
    linkedmeLink({
      // 这里面传你要携带的自定义参数
      id: '1',
      type: 'activity',
    }).then((res) => {
      console.log('获取的链接为', res);
      this.hrefUrl = res.url;
      const openHeader = document.getElementById('openHeader');
      openHeader.addEventListener('click', () => {
        linkedme.trigger_deeplink(res.url);
      });
    });
  },
};
</script>

<style>
main {
  position: relative;
  height: 100%;
  width: 100%;
}
.btn {
  position: absolute;
  top: 0;
  left: 0;
  height: 66px;
  width: 100vw;
  background: rgb(153, 147, 143);
}
a {
  line-height: 50px;
  background: linear-gradient(rgb(187, 150, 178) 0%, rgb(223, 207, 136) 100%);
  float: right;
  padding: 8px 18px;
  font-size: 14px;
  text-decoration: none;
}
</style>
